Setting Page Orientation using olePut

I've written an exporter which exports and marks proposed changes from the DOORS CPS and places them in context within their relative position in the specification document.  Some of the objects are OLE tables which need to be displayed in landscape.  I'm successful with inserting a section break at the correct position, and I'm able to connect up to the PageSetup property.  However, when I attempt to use olePut to set the Orientation property, nothing seems to happen.  The page is remaining in portrait.  Does anyone have experience with adjusting MS Word page orientation?


Jagtattoo - Tue Oct 08 07:29:43 EDT 2013

Re: Setting Page Orientation using olePut
adevicq - Tue Oct 08 08:26:21 EDT 2013

Hi,

Here is the code I use:

 

const int wdOrientLandscape = 1

const int   wdSectionBreakContinuous = 3

OleAutoObj objSetup      

clear objArgBlockput(objArgBlock, wdSectionBreakContinuous)

oleMethod(objSel, "InsertBreak", objArgBlock)

oleGet(objSel, "PageSetup", objSetup)    

olePut(objSetup, "Orientation", wdOrientLandscape)

 

Regards,

Alain


 

Re: Setting Page Orientation using olePut
Jagtattoo - Tue Oct 08 08:55:27 EDT 2013

adevicq - Tue Oct 08 08:26:21 EDT 2013

Hi,

Here is the code I use:

 

const int wdOrientLandscape = 1

const int   wdSectionBreakContinuous = 3

OleAutoObj objSetup      

clear objArgBlockput(objArgBlock, wdSectionBreakContinuous)

oleMethod(objSel, "InsertBreak", objArgBlock)

oleGet(objSel, "PageSetup", objSetup)    

olePut(objSetup, "Orientation", wdOrientLandscape)

 

Regards,

Alain


 

Thank you Alain for the rapid response.  I tried something very close to this with no luck.  I'll see if using the constants instead of the objArgBlock works as you suggest.  I appreciate the help!!

Re: Setting Page Orientation using olePut
David_G_Bond - Thu Oct 10 17:23:57 EDT 2013

I had a similar problem. Sometimes it would work and sometimes not. I discovered that if I get the existing orientation and then toggle the orientation if necessary, that seemed to work all the time. Use the method TogglePortrait.  It must be the difference between using a method and using a property.

- David Bond